﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace MotelCores
{
    public class Helpers
    {
        public static string GetValueNodeFromXMLStringSource(string source, string foundNode)
        {
            string result = string.Empty;
            var doc = XElement.Parse(source);
            var nodes = doc.Nodes();
            foreach (var item in nodes)
            {
                XElement cachedElement = item as XElement;
                if (cachedElement.Name.LocalName.CompareTo(foundNode) == 0){
                    return cachedElement.Value;
                };                                
            }
            return result;
        }
    }
}
